<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <h1>商品详情页</h1>

    <div class="box">
        <img src="" alt="">
        <h4>商品的名字</h4>

    </div>


    <script src="../js/ajax.js"></script>

    <script>

        // 商品列表跳转到详情页的时候，要携带商品id


        // 切割地址栏   拿到id
        const url = location.search.replace('?', '');
        console.log(url);

        const id = url.split('=')[1];
        console.log(id);

        ajax({
            path: `../php/detail.php?id=${id}`,
            success: res => {
                console.log(res);
                const { status, goods_img, good_title } = res;
                if (status) {

                } else {
                    alert("商品不存在");
                }
            }
        })

    </script>

</body>

</html>